# Scrapy settings for bili project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
#     https://docs.scrapy.org/en/latest/topics/settings.html
#     https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
#     https://docs.scrapy.org/en/latest/topics/spider-middleware.html

BOT_NAME = "bili"

SPIDER_MODULES = ["bili.spiders"]
NEWSPIDER_MODULE = "bili.spiders"


# Crawl responsibly by identifying yourself (and your website) on the user-agent
#USER_AGENT = "bili (+http://www.yourdomain.com)"

# Obey robots.txt rules
ROBOTSTXT_OBEY = False

# Configure maximum concurrent requests performed by Scrapy (default: 16)
#CONCURRENT_REQUESTS = 32

# Configure a delay for requests for the same website (default: 0)
# See https://docs.scrapy.org/en/latest/topics/settings.html#download-delay
# See also autothrottle settings and docs
#DOWNLOAD_DELAY = 3
# The download delay setting will honor only one of:
#CONCURRENT_REQUESTS_PER_DOMAIN = 16
#CONCURRENT_REQUESTS_PER_IP = 16

# Disable cookies (enabled by default)
#COOKIES_ENABLED = False

# Disable Telnet Console (enabled by default)
#TELNETCONSOLE_ENABLED = False

# Override the default request headers:
# DEFAULT_REQUEST_HEADERS = {
#    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
#    "Accept-Language": "en",
# }

DEFAULT_REQUEST_HEADERS = {
        'User-Agent': 'Baiduspider',
        'Cookie': "buvid3=0DF16BCE-48A0-4F6F-BF52-8DF38C0AB15F31424infoc; i-wanna-go-back=-1; _uuid=51E103B2B-16E1-FB210-6C3F-4B8368C9A10EF32541infoc; FEED_LIVE_VERSION=V8; home_feed_column=5; DedeUserID=17142789; DedeUserID__ckMd5=33ca17603f2deabe; b_ut=5; header_theme_version=CLOSE; CURRENT_PID=4891ba30-da67-11ed-a7b7-fbfdd5c7761d; rpdid=|(umRummul~m0J'uY)uRJ~kYl; browser_resolution=1512-827; CURRENT_QUALITY=80; nostalgia_conf=-1; LIVE_BUVID=AUTO6716850999627004; is-2022-channel=1; CURRENT_BLACKGAP=0; i-wanna-go-feeds=-1; fingerprint=cf5d54c029af4578755ca7274bbefa7f; buvid_fp_plain=undefined; buvid_fp=cf5d54c029af4578755ca7274bbefa7f; b_nut=1685794123; CURRENT_FNVAL=4048; SESSDATA=34ac036b%2C1701470931%2C5dbde%2A62; bili_jct=289a8930ca365fda43725e6e2a1d130f; bp_video_offset_17142789=803978720599605200; sid=6wrgzagi; buvid4=2CCC3DA7-13D9-4F66-583B-00E6F6AE2CE634009-023041409-QMGIJd+6/0xsbrYz1l6S7Q%3D%3D; b_lsid=28A6296D_18890F1411E; PVID=4"
}


# headers = {
#     'User-Agent': 'Baiduspider',
#     'Cookie': "buvid3=0DF16BCE-48A0-4F6F-BF52-8DF38C0AB15F31424infoc; i-wanna-go-back=-1; _uuid=51E103B2B-16E1-FB210-6C3F-4B8368C9A10EF32541infoc; FEED_LIVE_VERSION=V8; home_feed_column=5; DedeUserID=17142789; DedeUserID__ckMd5=33ca17603f2deabe; b_ut=5; header_theme_version=CLOSE; CURRENT_PID=4891ba30-da67-11ed-a7b7-fbfdd5c7761d; rpdid=|(umRummul~m0J'uY)uRJ~kYl; browser_resolution=1512-827; CURRENT_QUALITY=80; nostalgia_conf=-1; LIVE_BUVID=AUTO6716850999627004; is-2022-channel=1; CURRENT_BLACKGAP=0; i-wanna-go-feeds=-1; fingerprint=cf5d54c029af4578755ca7274bbefa7f; buvid_fp_plain=undefined; buvid_fp=cf5d54c029af4578755ca7274bbefa7f; b_nut=1685794123; CURRENT_FNVAL=4048; SESSDATA=34ac036b%2C1701470931%2C5dbde%2A62; bili_jct=289a8930ca365fda43725e6e2a1d130f; bp_video_offset_17142789=803978720599605200; sid=6wrgzagi; buvid4=2CCC3DA7-13D9-4F66-583B-00E6F6AE2CE634009-023041409-QMGIJd+6/0xsbrYz1l6S7Q%3D%3D; b_lsid=28A6296D_18890F1411E; PVID=4"
# }

# Enable or disable spider middlewares
# See https://docs.scrapy.org/en/latest/topics/spider-middleware.html
#SPIDER_MIDDLEWARES = {
#    "bili.middlewares.BiliSpiderMiddleware": 543,
#}

# Enable or disable downloader middlewares
# See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
#DOWNLOADER_MIDDLEWARES = {
#    "bili.middlewares.BiliDownloaderMiddleware": 543,
#}

# Enable or disable extensions
# See https://docs.scrapy.org/en/latest/topics/extensions.html
#EXTENSIONS = {
#    "scrapy.extensions.telnet.TelnetConsole": None,
#}

# Configure item pipelines
# See https://docs.scrapy.org/en/latest/topics/item-pipeline.html
#ITEM_PIPELINES = {
#    "bili.pipelines.BiliPipeline": 300,
#}

# Enable and configure the AutoThrottle extension (disabled by default)
# See https://docs.scrapy.org/en/latest/topics/autothrottle.html
#AUTOTHROTTLE_ENABLED = True
# The initial download delay
#AUTOTHROTTLE_START_DELAY = 5
# The maximum download delay to be set in case of high latencies
#AUTOTHROTTLE_MAX_DELAY = 60
# The average number of requests Scrapy should be sending in parallel to
# each remote server
#AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
# Enable showing throttling stats for every response received:
#AUTOTHROTTLE_DEBUG = False

# Enable and configure HTTP caching (disabled by default)
# See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
#HTTPCACHE_ENABLED = True
#HTTPCACHE_EXPIRATION_SECS = 0
#HTTPCACHE_DIR = "httpcache"
#HTTPCACHE_IGNORE_HTTP_CODES = []
#HTTPCACHE_STORAGE = "scrapy.extensions.httpcache.FilesystemCacheStorage"

# Set settings whose default value is deprecated to a future-proof value
REQUEST_FINGERPRINTER_IMPLEMENTATION = "2.7"
TWISTED_REACTOR = "twisted.internet.asyncioreactor.AsyncioSelectorReactor"
FEED_EXPORT_ENCODING = "utf-8"
